<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
   
  <meta name="keywords" content="不矜，不伐，不自是" />
   
  <meta name="description" content="无名之辈" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    hexo博客搭建 |  晓康的博客
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/style.css">

  
<script src="/js/pace.min.js"></script>


  

  

<link rel="alternate" href="/atom.xml" title="晓康的博客" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-hexo博客搭建" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  hexo博客搭建
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/ck6r6m2cx000kl0rh400n3iqf/" class="article-date">
  <time datetime="2020-02-16T04:44:55.000Z" itemprop="datePublished">2020-02-16</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/%E5%BB%BA%E7%AB%99/">建站</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.6k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">6分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <p>SAMBA、SVN、GIT、建站这些算是基本需求，云服务器免费期一过就感觉太贵了，青云价格适中不过最后为了Google选择了Vultr，还是被墙玩的体无完肤，建站念头没有了，但是博客还是不能少。</p>
<p>回归初心，我需要的只是一个静态博客，hexo搭建博客，主题秒切，效果很好啊……</p>
<a id="more"></a>

<h2 id="目的"><a href="#目的" class="headerlink" title="目的"></a>目的</h2><p>win7 64位，搭建本地hexo生成静态博客网页并将其部署到码云（gitee.com）</p>
<h2 id="步骤："><a href="#步骤：" class="headerlink" title="步骤："></a>步骤：</h2><h3 id="程序安装"><a href="#程序安装" class="headerlink" title="程序安装"></a>程序安装</h3><ol>
<li><p>安装Git Bash<br><a href="https://git-scm.com/" target="_blank" rel="noopener">https://git-scm.com/</a></p>
</li>
<li><p>安装Node.js<br><a href="https://nodejs.org/zh-cn/" target="_blank" rel="noopener">https://nodejs.org/zh-cn/</a><br>Next安装完成后，任意目录打开gitbash确认npm命令是否可用，不能用则添加环境变量</p>
</li>
<li><p>安装hexo<br><a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">https://hexo.io/zh-cn/</a><br>hexo是基于node.js环境的静态博客框架，安装Node.js后并成功配置环境变量后，gitbash的命令行就能使用npm指令，新建myblog文件夹存放hexo目录文件，进入myblog文件，右击使用git bash here打开git命令行，安装 hexo-cli：</p>
<p><code>npm install hexo-cli -g</code></p>
<p>gitbash如果不能使用hexo命令则继续安装hexo：</p>
<p><code>npm install hexo --save</code></p>
<p>初始化：</p>
<p><code>hexo init</code></p>
<p>hexo的初始化实际上是生成hexo目录文件（从github拉取目录和主题）</p>
<p>下图显示了不同操作生成了相应目录文件：</p>
<p><img src="/2020/ck6r6m2cx000kl0rh400n3iqf/1581946156345.png" alt="1581946156345"></p>
</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">备注：</span><br><span class="line">- *node_modules：是依赖包*</span><br><span class="line">- *public：存放的是生成的页面*</span><br><span class="line">- *scaffolds：命令生成文章等的模板*</span><br><span class="line">- *source：用命令创建的各种文章*</span><br><span class="line">- *themes：主题*</span><br><span class="line">- *_config.yml：整个博客的配置*</span><br><span class="line">- *db.json：source解析所得到的*</span><br><span class="line">- *package.json：项目所需模块项目的配置信息*</span><br><span class="line">- *public：生成的静态博客，hexo clean时会清楚，deploy时默认忽略*</span><br></pre></td></tr></table></figure>
<ol start="4">
<li><p>安装图片导入插件</p>
<p>先确认 配置文件中的代码：<em>post_asset_folder: true</em> </p>
<p> npm install <a href="https://github.com/CodeFalling/hexo-asset-image" target="_blank" rel="noopener">https://github.com/CodeFalling/hexo-asset-image</a> – save </p>
<p>安装完成使用hexo g后才能正常显示博客图片</p>
</li>
</ol>
<ol start="5">
<li>网页本地验证</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">hexo clean # 清空已有hexo网站文件</span><br><span class="line">hexo generate 或者 (hexo g)  # 依据网页文本与新的CSS样式生成新网站文件</span><br><span class="line">hexo server 或者 (hexo s)    # 启动本地服务器，可以在localhost:4000查看网站修改效果</span><br></pre></td></tr></table></figure>
<p>查看本地显示，确认图片加载是否正常</p>
<p>主题所需插件的安装配置<br>查看网页各功能，如有缺失，按照主题说明操作，目前使用ayer主题<br><a href="https://shen-yu.gitee.io/2019/ayer/" target="_blank" rel="noopener">https://shen-yu.gitee.io/2019/ayer/</a></p>
<p>提示：<code>查看命令执行后的log，按照指示操作，缺什么安装什么，如果还是不行，建议copy别人的完整hexo目录，稍作修改即可使用。</code></p>
<h3 id="同步gitee仓库"><a href="#同步gitee仓库" class="headerlink" title="同步gitee仓库"></a>同步gitee仓库</h3><p>重要的是使远程仓库和本地git成功连接，注意以下：</p>
<ol>
<li><p>本地生成SSH并添加到gitee</p>
</li>
<li><p>windows会自动跳出登陆gitee，输入账号密码即可</p>
</li>
<li><p>gitee端的网页部署不是自动的，每deploy一次需要更新一次<br><img src="/2020/ck6r6m2cx000kl0rh400n3iqf/1581832644820.png" alt="1581832644820"></p>
<p>git基础操作可以参考：廖雪峰git博客</p>
<p> <a href="https://www.liaoxuefeng.com/wiki/896043488029600" target="_blank" rel="noopener">https://www.liaoxuefeng.com/wiki/896043488029600</a> </p>
</li>
</ol>
<h3 id="配置网页"><a href="#配置网页" class="headerlink" title="配置网页"></a>配置网页</h3><h4 id="ayer主题"><a href="#ayer主题" class="headerlink" title="ayer主题"></a>ayer主题</h4><p>修改及配置主题内容参考ayer主题作者：</p>
<p>主题git：</p>
<p> <a href="https://gitee.com/shen-yu/hexo-theme-ayer" target="_blank" rel="noopener">https://gitee.com/shen-yu/hexo-theme-ayer</a> </p>
<p>网页成品：</p>
<p> <a href="https://shen-yu.gitee.io/" target="_blank" rel="noopener">https://shen-yu.gitee.io/</a> </p>
<p>网页源码：</p>
<p> <a href="https://gitee.com/shen-yu/shen-yu" target="_blank" rel="noopener">https://gitee.com/shen-yu/shen-yu</a> </p>
<p>本地hexo源码：</p>
<p> <a href="https://gitee.com/shen-yu/shen-yu/tree/dev/" target="_blank" rel="noopener">https://gitee.com/shen-yu/shen-yu/tree/dev/</a> </p>
<h4 id="其他主题"><a href="#其他主题" class="headerlink" title="其他主题"></a>其他主题</h4><p> <a href="https://hexo.io/themes/" target="_blank" rel="noopener">https://hexo.io/themes/</a> </p>
<p>感兴趣的主题：</p>
<p> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="noopener">https://github.com/fluid-dev/hexo-theme-fluid</a> </p>
<h2 id="注意点总结"><a href="#注意点总结" class="headerlink" title="注意点总结"></a>注意点总结</h2><pre><code>1. 最快的方式不是step by step，而是clone别人的hexo源码（不是网页镜像）回来自己改，这样本地可以迅速跑起来
2. 要想成功导入md根目录下的图片文件夹，需要安装插件，同时不要忘了顶层yml中的配置
3. 习惯使用hexo new（n） XXX 来新建博客，hexo怎么记？是嘿咻！嘿咻！
4. 两个地址非常重要，否则无法deploy和部署，一个是deploy中git的目标地址，一个是hexo根目录下yml中的【url: https://an_kang.gitee.io】
5. 最后，就是码云的gitpage不会自动部署网页，需要手动点“更新”</code></pre><h2 id="本地hexo目录的利用"><a href="#本地hexo目录的利用" class="headerlink" title="本地hexo目录的利用"></a>本地hexo目录的利用</h2><p>利用已经搭建好的本地hexo，拷贝到另一台电脑，制作一个自定义的hexo starter，避免重复安装一些功能模块</p>
<p>注意：</p>
<p><img src="/2020/ck6r6m2cx000kl0rh400n3iqf/1581956119297.png" alt="1581956119297"></p>
<p>现成目录下执行hexo clean在之后的目录打包即可，需要保证包含红框两个文件夹。</p>
<p>将该目录推送到git会出问题，原因在于gitignore定义了一些git的忽略项目，所以需要删除根目录和主题文件夹下的.gitignore文件。</p>
<p><strong>如果在新电脑上写博客，安装nodejs环境后，直接使用此目录即可</strong>。</p>
<p>如果delpoy失败，尝试删除.deploy_git文件夹</p>
<h2 id="其他参考资料"><a href="#其他参考资料" class="headerlink" title="其他参考资料"></a>其他参考资料</h2><table>
<thead>
<tr>
<th>URL</th>
<th>备注</th>
</tr>
</thead>
<tbody><tr>
<td><a href="https://segmentfault.com/a/1190000018662692" target="_blank" rel="noopener">https://segmentfault.com/a/1190000018662692</a></td>
<td>里面忽略了图片生成的问题</td>
</tr>
<tr>
<td><a href="https://blog.csdn.net/Fitz1318/article/details/86548129" target="_blank" rel="noopener">https://blog.csdn.net/Fitz1318/article/details/86548129</a></td>
<td>图片生成补充</td>
</tr>
<tr>
<td><a href="https://www.cnblogs.com/visugar/p/6821777.html" target="_blank" rel="noopener">https://www.cnblogs.com/visugar/p/6821777.html</a></td>
<td>较全面</td>
</tr>
</tbody></table>
<h2 id="其他问题"><a href="#其他问题" class="headerlink" title="其他问题"></a>其他问题</h2><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">Xiaokang@Xiaokang-PC MINGW64 &#x2F;g&#x2F;myweb&#x2F;test</span><br><span class="line">$ hexo</span><br><span class="line">Usage: hexo &lt;command&gt;</span><br><span class="line"></span><br><span class="line">Commands:</span><br><span class="line">  help     Get help on a command.</span><br><span class="line">  init     Create a new Hexo folder.</span><br><span class="line">  version  Display version information.</span><br><span class="line"></span><br><span class="line">Global Options:</span><br><span class="line">  --config  Specify config file instead of using _config.yml</span><br><span class="line">  --cwd     Specify the CWD</span><br><span class="line">  --debug   Display all verbose messages in the terminal</span><br><span class="line">  --draft   Display draft posts</span><br><span class="line">  --safe    Disable all plugins and scripts</span><br><span class="line">  --silent  Hide output on console</span><br><span class="line"></span><br><span class="line">For more help, you can use &#39;hexo help [command]&#39; for the detailed information</span><br><span class="line">or you can check the docs: http:&#x2F;&#x2F;hexo.io&#x2F;docs&#x2F;</span><br></pre></td></tr></table></figure>

<p>安装nodejs之后使用npm安装hexo-cli，然后就能使用hexo命令（如上），但是<code>hexo init</code>之后便无法使用hexo命令，提示<code>Local hexo not found</code></p>
<p><img src="/2020/ck6r6m2cx000kl0rh400n3iqf/1581941123512.png" alt="1581941123512"></p>
<p>按照错误指示，<code>npm install hexo --save</code>后一切正常。</p>
<p>可能的原因是，hexo-cli是全局安装的，在电脑中任意文件夹下都可使用，但是一旦这个局部hexo文档创建之后，就需要自己独立的hexo模块来控制，所以需要再安装hexo。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">Usage: hexo &lt;command&gt;</span><br><span class="line"></span><br><span class="line">Commands:</span><br><span class="line">  clean     Remove generated files and cache.</span><br><span class="line">  config    Get or set configurations.</span><br><span class="line">  deploy    Deploy your website.</span><br><span class="line">  generate  Generate static files.</span><br><span class="line">  help      Get help on a command.</span><br><span class="line">  init      Create a new Hexo folder.</span><br><span class="line">  list      List the information of the site</span><br><span class="line">  migrate   Migrate your site from other system to Hexo.</span><br><span class="line">  new       Create a new post.</span><br><span class="line">  publish   Moves a draft post from _drafts to _posts folder.</span><br><span class="line">  render    Render files with renderer plugins.</span><br><span class="line">  version   Display version information.</span><br><span class="line"></span><br><span class="line">Global Options:</span><br><span class="line">  --config  Specify config file instead of using _config.yml</span><br><span class="line">  --cwd     Specify the CWD</span><br><span class="line">  --debug   Display all verbose messages in the terminal</span><br><span class="line">  --draft   Display draft posts</span><br><span class="line">  --safe    Disable all plugins and scripts</span><br><span class="line">  --silent  Hide output on console</span><br><span class="line"></span><br><span class="line">For more help, you can use &#39;hexo help [command]&#39; for the detailed information</span><br><span class="line">or you can check the docs: http:&#x2F;&#x2F;hexo.io&#x2F;docs&#x2F;</span><br></pre></td></tr></table></figure>

<p>以上，缺少server命令，手动安装</p>
<p><code>npm install hexo-server --save</code></p>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://an_kang.gitee.io/2020/ck6r6m2cx000kl0rh400n3iqf/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Blog%E6%90%AD%E5%BB%BA/" rel="tag">Blog搭建</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/ck6r6m2c00001l0rh02xrbyl8/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            MarkDown语法导致hexo页面生成BUG
          
        </div>
      </a>
    
    
      <a href="/2020/ck6r6m2cs000fl0rh5tg3236z/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">VeriLog学习笔记-2020.02.15</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'JY6tekdhqfeJz8rALTVDemJ9-gzGzoHsz',
        app_key: 'DrBLLXiFYlEXJqYtDTbvvB5L',
        path: window.location.pathname,
        notify: 'true',
        verify: 'false',
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2019-2020
        an_kang
      </li>
      <li>
        
          Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
      </li>
    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="晓康的博客"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>吓着了吧，哈~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
      
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<script src="/js/share.js"></script>




<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['学而不思则罔，思而不学则殆','',''],
    startDelay: 300,
    typeSpeed: 200,
    loop: true,
    backSpeed: 100,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer:'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>


<script>
  var ayerConfig = {
    mathjax: false
  }
</script>


<script src="/js/ayer.js"></script>


<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>




<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>